#include <windows.h>
#include <cstring>

using namespace std;

//-----------------------------------------------------------------------

LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
HWND hWnd; 
HWND hwndCity;
HWND hwndState;
HWND hwndCountry;

//-----------------------------------------------------------------------

int WINAPI WinMain(HINSTANCE hInstance, 
				   HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, 
				   int nCmdShow) {

	WNDCLASS wc;
	wc.lpszClassName = L"LocationClass";
	wc.lpfnWndProc = MainWndProc;
	wc.style = CS_OWNDC | CS_VREDRAW | CS_HREDRAW;
	wc.hInstance = hInstance;
	wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );
	wc.hCursor = LoadCursor( NULL, IDC_ARROW );
	wc.hbrBackground = (HBRUSH)( COLOR_WINDOW+1 );
	wc.lpszMenuName = L"";
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	RegisterClass(&wc);

	hWnd = CreateWindow(
		L"LocationClass", 
		L"Location", 
		WS_OVERLAPPEDWINDOW, 
		CW_USEDEFAULT, 
		CW_USEDEFAULT, 
		250, 
		150, 
		NULL, 
		NULL, 
		hInstance, 
		NULL);
	hwndCity = CreateWindow( 
		L"Static", 
		L"City: New York", 
		WS_VISIBLE | WS_CHILD,
		10,
		10, 
		200, 
		20, 
		hWnd,
		NULL, 
		hInstance, 
		NULL); 
	hwndState = CreateWindow( 
		L"Static", 
		L"State: New York", 
		WS_VISIBLE | WS_CHILD,
		10,
		35, 
		200, 
		20, 
		hWnd,
		NULL, 
		hInstance, 
		NULL); 
	hwndCountry = CreateWindow( 
		L"Static", 
		L"Country: USA", 
		WS_VISIBLE | WS_CHILD,
		10,
		60, 
		200, 
		20, 
		hWnd,
		NULL, 
		hInstance, 
		NULL); 

	ShowWindow(hWnd, nCmdShow);
//	EnableWindow(hwndState, FALSE);
//	ShowWindow(hwndState, SW_HIDE);
	MSG msg;
	while(GetMessage(&msg, NULL, 0, 0 )) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return (int) msg.wParam;
}

//-----------------------------------------------------------------------

LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, 
	WPARAM wParam, LPARAM lParam) {
	HWND hwndCtl = (HWND) lParam;
	switch (msg) {
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
		default:
			return DefWindowProc(hWnd, msg, wParam, lParam);
	}
	return 0;
}

//-----------------------------------------------------------------------
